<?php

namespace App\Http\Admin\Controllers\Order;

use App\Http\Admin\Services\Order\OrderService;
use App\Http\Controllers\Controller;
use App\Http\Models\OrderRefundReg;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;


class OrderRefundController extends Controller
{
    protected $service;

    public function __construct(OrderService $orderService)
    {
        $this->service = $orderService;
    }


    /*
     * 退款率报表
     */
    public function index()
    {
        return view('order.order_refund');
    }

    /*
     * 退款登记
     */
    public function refund(){
        return view('order.order_refund_reg');
    }

    /*
     * 列表
     */

    public function list(Request $request){

        $attributes =   $request->all();

        $result =   $this->service->refundReg($attributes);

        return res('退货订单', $result);

    }


    /*
     * 登记
     */
    public function register(Request $request){

        $attributes =   $request->all();

        $result =   $this->service->register($attributes);

        return res('登记成功');

    }

    /*
     *售卖登记
     */
    public function saleRegister(Request $request){


        $attributes =   $request->all();

        $result =   $this->service->saleRegister($attributes);

        return res('登记成功');

    }

    /*
     * export
     */
    public function export(Request $request){

        $attributes =   $request->all();
        //导出excel
        $this->service->refundExport($attributes);

    }

    /*
     * delete
     */
    public function delete(Request $request){

        $attributes =   $request->all();

        $this->service->delete($attributes);

        return res('ok');
    }




}